﻿@{
    ViewBag.Title = "OAuth授权列表";
}
<div class="pageheader">
    <div class="page-bar">
        <ul class="page-breadcrumb">
            <li><a href="javascript:;"><i class="iconfont icon-home1"></i> 首页</a> </li>
            <li><a href="javascript:;">会员设置</a> </li>
            <li><a href="javascript:;">OAuth授权列表</a> </li>
        </ul>
    </div>
</div>
<div class="layui-fluid">
    <div class="layui-card layui-tab">
        <div class="layui-card-body table-tool-mini">
            <div class="layui-form toolbar">
                <div class="layui-form-item">
                    <div class="layui-inline menu-list">
                        <label class="layui-form-label w-auto"></label>
                        <div class="layui-input-inline mr0">
                            <input id="txtKeywords" class="layui-input" type="text" placeholder="输入关键字" />
                        </div>
                        <button id="btnSearchAuth" data-type="btnSearch" class="layui-btn icon-btn layui-btn-normal layui-btn-sm">
                            <i class="layui-icon">&#xe615;</i>
                        </button>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-btn-group">
                            <a class="layui-btn icon-btn layui-btn-normal layui-btn-sm" href="../users/site_oauth_list"><i class="iconfont icon-setting"></i><span> OAuth设置</span></a>
                            <a data-type="btnDelete" class="layui-btn icon-btn layui-btn-normal layui-btn-sm"><i class="iconfont icon-delete"></i><span> 删除</span></a>
                        </div>
                    </div>
                </div>
            </div>
            <table class="layui-table" lay-data="{page:true, id:'ltable'}" lay-filter="ltable">
                <thead>
                    <tr>
                        <th lay-data="{checkbox:true}"></th>
                        <th lay-data="{field:'user_name'}">绑定帐户</th>
                        <th lay-data="{field:'oauth_name'}">授权平台</th>
                        <th lay-data="{field:'oauth_access_token'}">Access Token</th>
                        <th lay-data="{field:'oauth_openid'}">UId</th>
                        <th lay-data="{field:'add_time'}">授权时间</th>
                    </tr>
                </thead>
            </table>
        </div>
    </div>
</div>
@section Scripts{
    <script type="text/javascript">
        layui.use(['table','cmswh'], function () {
            var table = layui.table, form = layui.form, cmswh = layui.cmswh, $ = layui.jquery;
            cmswh.dataBind('OauthList');
            var active = {
                btnDelete: function () {
                    cmswh.batOperate('OauthDelete', 'id');
                },
                btnSearch: function () {
                    table.reload('ltable', { page: { curr: 1 }, where: getcond() });
                }
            };
            $('.layui-inline .layui-btn').on('click', function () {
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });
            /*拼接条件返回postdata*/
        function getcond() {
            var keywords = $("#txtKeywords").val();
            var postdata = { keywords: keywords };
            return postdata;
        }
        });
    </script>
}